package com.liu.serializeable;

import java.io.FileOutputStream;
import java.io.ObjectOutputStream;

/**
 * 普通序列化
 */
public class OrdinarySerializable {
    public static void main(String[] args) {
        try {
            //创建一个ObjectOutputStream输出流
            ObjectOutputStream oos = new ObjectOutputStream(new FileOutputStream("xxx.txt"));
            //将对象序列化到文件
            Person person = new Person("刘波", 25);
            oos.writeObject(person);
        } catch (Exception e) {
            e.printStackTrace();
        }
    }
}
